<?php
/*
  功能：用户导入错误日志 model
  作者：cxm
  时间：2019-10-23
*/

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserImportErrorLog extends BaseModel {
    use SoftDeletes;
    protected $dates = ['deleted_at']; //开启deleted_at
    protected $table='user_import_error_log';  //绑定表

    /**
     * excel 数据回显
     * @return mixed
     */
    public function getExcelDataAttribute(){
        if (!isset($this->attributes['excel_data']) || empty($this->attributes['excel_data'])) {
            return [];
        }
        $excel_data = $this->attributes['excel_data'];
        return json_decode($excel_data,true);
    }
}